package org.ant.gui.panes.ACtextpanel.types;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

import org.ant.util.ResourceHandler;

public class TokenStyles {
	private ArrayList<TokenType> types;
	private ResourceHandler resources;

	public TokenStyles(){
		resources = new ResourceHandler("KeyWord");
		types = new ArrayList<TokenType>();
		initTypes();
	}
	

	private void initTypes() {
		SimpleAttributeSet attributes1 = new SimpleAttributeSet();                            
		StyleConstants.setForeground(attributes1, Color.blue);        			
		StyleConstants.setUnderline(attributes1, false);
		
		String[] kw1 = ResourceHandler.tokenize(this.resources.getResourceString("KeyWord1"));
		for (String s:kw1){
			TokenType t = new KeywordType(s,attributes1);
			types.add(t);
		}
		
		SimpleAttributeSet attributes2 = new SimpleAttributeSet();                            
		StyleConstants.setForeground(attributes2, Color.red);        			
		StyleConstants.setUnderline(attributes2, false);
		
		String[] kw2 = ResourceHandler.tokenize(this.resources.getResourceString("KeyWord2"));
		for (String s:kw2){
			TokenType t = new KeywordType(s,attributes2);
			types.add(t);
		}
	}


	public ArrayList<TokenType> getTypes() {
		return types;
	}
	
	

}
